// transform.js
export function transformHotelData(hotelData) {
  // 确保输入是数组
  if (!Array.isArray(hotelData)) {
    console.error('输入数据不是数组:', hotelData);
    return [];
  }
  
  return hotelData.map(hotel => {
    return [
      {
        width: '200px',
        type: '1',
        title: hotel.hotel_name,
        content: hotel.hotel_name
      },
      {
        type: '1',
        title: hotel.bgl,
        content: hotel.bgl,
        width: '120px'
      },
      {
        type: '1',
        title: hotel.sstd || '0',
        content: hotel.sstd || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.zdjy || '0',
        content: hotel.zdjy || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.zr_xs || '0',
        content: hotel.zr_xs || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.zr_ld || '0',
        content: hotel.zr_ld || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.zr_mj || '0',
        content: hotel.zr_mj || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.ss_fk || '--',
        content: hotel.ss_fk || '--',
        width: '120px'
      },{
		type:'1',
		title: hotel.sspm || '--',
		content: hotel.sspm || '--',
		width: '120px'  
	  },{
		type:'1',
		title: hotel.dpf || '--',
		content: hotel.dpf || '--',
		width: '120px'  
	  },
      {
        type: '2',
        title: parseFloat(hotel.bg_zhl) || 0,
        content: parseFloat(hotel.bg_zhl) || 0,
        width: '120px'
      },
      {
        type: '2',
        title: parseFloat(hotel.xd_zhl) || 0,
        content: parseFloat(hotel.xd_zhl) || 0,
        width: '120px'
      },
      {
        type: '2',
        title: parseFloat(hotel.cj_zhl) || 0,
        content: parseFloat(hotel.cj_zhl) || 0,
        width: '120px'
      },
      {
        type: '1',
        title: hotel.psi || '0',
        content: hotel.psi || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.fiv_hf || '0%',
        content: hotel.fiv_hf || '0%',
        width: '120px'
      },
      {
        type: '1',
        title: '点击下载',
        content: '点击下载',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.ly || '',
        content: hotel.ly || '',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.jzt?.cpcCampaignReportBo?.clicks || '0',
        content: hotel.jzt?.cpcCampaignReportBo?.clicks || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.jzt?.cpcCampaignReportBo?.orderAmount || '0',
        content: hotel.jzt?.cpcCampaignReportBo?.orderAmount || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.jzt?.cpcCampaignReportBo?.todayCost || '0',
        content: hotel.jzt?.cpcCampaignReportBo?.todayCost || '0',
        width: '120px'
      },
      {
        type: '1',
        title: hotel.jzt?.cpcCampaignReportBo?.roas || '0',
        content: hotel.jzt?.cpcCampaignReportBo?.roas || '0',
        width: '120px'
      },{
        type: '1',
        title: hotel.jzt?.cpcCampaignReportBo?.bookings || '0',
        content: hotel.jzt?.cpcCampaignReportBo?.bookings || '0',
        width: '120px'
      },{
        type: '1',
        title: hotel.jzt?.cpcCampaignReportBo?.nights || '0',
        content: hotel.jzt?.cpcCampaignReportBo?.nights || '0',
        width: '120px'
      },
      {
        type: '3',
        title: '查看房态',
        content: '查看房态',
        width: '120px'
      }
    ];
  });
}